package b3.widget.home.town
{
	import b3.config.*;
	import b3.model.*;
	import b3.net.*;
	import b3.util.*;
	import b3.widget.*;
	import b3.widget.basic.*;
	
	import com.greensock.*;
	
	import flash.display.*;
	import flash.events.*;
	import flash.filters.*;
	import flash.text.*;

	public class GoldIngotPane extends BasicWidget
	{
		private var goldIngotText:TextField;
		
		public function GoldIngotPane()
		{
			super();
			var GoldIngotPaneBgr:Class = ResourceHelper.getInstance().getClassByName("GoldIngotPaneBgr");
			addChild(new GoldIngotPaneBgr());
			goldIngotText = new TextField();
			goldIngotText.selectable = false;
        	goldIngotText.autoSize = TextFieldAutoSize.CENTER;
			goldIngotText.defaultTextFormat = new TextFormat(BFont.fontName, 13, 0x000000);
//			goldIngotText.filters = [new GlowFilter(0xFFFF00, 1, 1.3, 1.3, 100, BitmapFilterQuality.HIGH)];
			goldIngotText.x = 50;
			goldIngotText.y = -2;
			addChild(goldIngotText);
			PlayerManager.getInstance().me.packageModel.addEventListener(ModelEvent.REFRESH, onRefresh);
			this.addEventListener(MouseEvent.MOUSE_OVER,onMouseOver);
			this.addEventListener(MouseEvent.MOUSE_OUT, onMouseOut);
			onRefresh(null);
		}
		
		private function onRefresh(event:Event):void
		{
			var goldIngot:int = PlayerManager.getInstance().me.packageModel.getObjectNum(ObjConfig.GOLDINGOT);
			goldIngotText.text = " " + BFont.formatNumWithComa(goldIngot) + " ";
		}
			
		private function onMouseOver(event:MouseEvent):void
		{
		}
		
		private function onMouseOut(event:MouseEvent):void
		{
		}
	}
}